package logic

import (
	"context"
	"ewaimai/waimairpc/models"

	"ewaimai/waimairpc/internal/svc"
	"ewaimai/waimairpc/waimairpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShopAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewShopAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShopAddLogic {
	return &ShopAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ShopAddLogic) ShopAdd(in *waimairpc.ShopAddRequest) (*waimairpc.ShopAddResponse, error) {
	// todo: add your logic here and delete this line
	var p models.ShopPeople
	p.Image = in.Image
	p.Video = in.Video
	p.Peoplelogo = in.Peoplelogo
	if err := p.Create(); err != nil {
		logx.Errorf("上传成功")
	}
	return &waimairpc.ShopAddResponse{
		Id: int64(p.ID),
	}, nil
}
